/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package battleship;
/**
 *
 * @author Code and Psuedocode: Ammar Ahmed
 */
//makes the squers
public class Cell
{
  // A cell object knows about its location in the grid as well as its size with the variables x, y, w, h.
  int x,y;   // x,y location
  int w,h;   // width and height
  int R=0;
  int G=0;
  int B=0;
  boolean isEmpty;
  boolean isHit;

  // Cell Constructor
  Cell(int tempX, int tempY, int tempW, int tempH)
  {
    x = tempX;
    y = tempY;
    w = tempH;
    h = tempW;
    isEmpty = true; //plain water
    isHit = false;  // ship in it is not hit
    isEmpty();
  }

  //draw a circle inside the squer if it is not empty
  void isEmpty()
  {
    if(isEmpty == true)
    {
      R=0;
      G = 0;
      B = 255; //blue
    }
    else
    {
      if(isHit == true) //ship is hit = red
      {
        R = 255;
        G = 0;
        B = 0;
      }
      else    //ship is safe = green
      {
        R = 0;
        G = 250;
        B = 0;
      }
    }
  }

  void tested()
  {
      R = 0;
      G = 0;
      B = 0;
  }

  /**
   * Color all the blocks
   * @param C
   */
  void color(char C)
  {
      if (C == 'N')
      {
        R = 0;
        G = 0;
        B = 255; //blue
      }

      if (C == 'C')
      {
          R = 142;
          G = 205;
          B = 240; //blue
      }

      if (C == 'A')
      {
          R = 0;
          G = 255;
          B = 0; //
      }
      if ( C == 'B')
      {
          R = 196;
          G = 0;
          B = 38; //
      }
      if ( C == 'S')
      {
          R = 255;
          G = 102;
          B = 0; //
      }
      if ( C == 'D')
      {
          R = 255;
          G = 255;
          B = 0;
      }

  }

  void hit()
  {
      R = 250;
      G = 0;
      B = 0;
  }

}